package edu.zut2.extends_demo3;

/**
 * 轿车继承汽车类
 */
public class Car extends Vehicle {
    //荷载人数
    int loader;

//    public Car() {
//        super();
//    }

    public Car(String brand, String color, double speed, int loader) {
        super(brand, color, speed);
//        this.brand = brand;
//        this.color = color;
        this.loader = loader;
    }


    /**
     * 方法的重写：
     */
    @Override
    public void run() {
        super.run();
        System.out.println("当前轿车荷载人数：" + loader);
    }


    public static void main(String[] args) {
        Car car = new Car("奥迪", "黄色", 250.0, 4);
        //子类重写父类的方法之后，调用的就是自己重写后的
        car.run();
    }

}
